package cn.iocoder.yudao.module.dt.dal.mysql.activityadmin;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.dt.dal.dataobject.activityadmin.ActivityAdminDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.dt.controller.admin.activityadmin.vo.*;

/**
 * 活动管理员表，用作核销等权限 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ActivityAdminMapper extends BaseMapperX<ActivityAdminDO> {

    default PageResult<ActivityAdminDO> selectPage(ActivityAdminPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivityAdminDO>()
                .eqIfPresent(ActivityAdminDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ActivityAdminDO::getOpenId, reqVO.getOpenId())
                .eqIfPresent(ActivityAdminDO::getActivityId, reqVO.getActivityId())
                .betweenIfPresent(ActivityAdminDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivityAdminDO::getId));
    }

    default List<ActivityAdminDO> selectList(ActivityAdminExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ActivityAdminDO>()
                .eqIfPresent(ActivityAdminDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ActivityAdminDO::getOpenId, reqVO.getOpenId())
                .eqIfPresent(ActivityAdminDO::getActivityId, reqVO.getActivityId())
                .betweenIfPresent(ActivityAdminDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivityAdminDO::getId));
    }

}
